<?xml version="1.0" encoding="UTF-8"?>
<ui:composition
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
	template="/WEB-INF/templates/public/default.xhtml"
>

	<f:metadata>
		<f:viewParam
			name="serviceSupplierId"
			value="#{serviceSupplierHome.id}"
		></f:viewParam>
		<f:viewParam
			name="debug"
			value="#{serviceSupplierHome.debug}"
		></f:viewParam>
		<f:event
			listener="#{serviceSupplierHome.initConversation()}"
			type="preRenderView"
		></f:event>
	</f:metadata>

	<ui:define name="head">
		<style type="text/css">
			.removeButton {
				float: right;
				margin-right: 20px;
			}
			
			td {
				padding-bottom: 10px;
			}
			
			label {
				font-weight: bold;
			}
			.template{
				color: #f4221c;
				font-size: 10px;
			}
			.photoItem {
				float: left;
			}
		</style>
		<h:outputStylesheet name="css/public/newuser-registration.css" />
		<h:outputStylesheet name="css/public/override_primefaces.css"></h:outputStylesheet>
	</ui:define>

	<ui:define name="content">

		<div class="sub_wrap">
			<div class="Methbox_tit">
				<h2>中介机构用户注册</h2>
				<span><p:link
					outcome="/index.xhtml"
					target="_blank"
				>平台首页</p:link> &gt;用户注册</span>
			</div>
			<div class="Methbox_con">
				<!--注册过程-->
				<div class="register-guocheng">
					<div class="fleft rg-guocheng nureg-cont">
						<span class="rg-span"> 1</span>
						<h4 class="rg-h4">平台注册协议</h4>
					</div>
					<div class="fleft rg-guocheng">
						<span class="rg-span"> 2</span>
						<h4 class="rg-h4">填写账号信息</h4>
					</div>
					<div class="fleft rg-guocheng2">
						<span class="rg-span2"> 3</span>
						<h4 class="rg-h42">注册成功</h4>
					</div>
					<div class="clearbt"></div>
					<div class="reghr-box">
						<hr class="reghr" style="width: 75%" />
					</div>
				</div>
				<h:form id="editForm">
					<p:messages id="messages" closable="true"><p:autoUpdate/></p:messages>			
					<p:panel
						id="baseInfo"
						style="margin-bottom:10px;"
						styleClass="nureg-cont nuregcbox nuregcboxsty"
					>
						<h:panelGrid
							columns="2"
							cellpadding="5"
						>
							<p:outputLabel
								for="cnname"
								value="公司名称"
							/>
							<p:inputText
								id="cnname"
								value="#{serviceSupplierHome.instance.cnname}"
								required="true"
								styleClass="input-large">
								<f:validator binding="#{cnnameValidator}"></f:validator>
								<f:ajax render="@this" />
								</p:inputText>
	
							<p:outputLabel
								for="companyType"
								value="单位性质或组织形式"
							/>
							<p:selectOneMenu
								id="companyType"
								value="#{serviceSupplierHome.instance.companyType}"
								required="true"
							>
								<f:selectItem
									itemLabel="请选择"
									itemValue="#{null}"
								/>
								<f:selectItem
									itemLabel="国有企业"
									itemValue="国有企业"
								/>
								<f:selectItem
									itemLabel="有限公司"
									itemValue="有限公司"
								/>
								<f:selectItem
									itemLabel="事业单位"
									itemValue="事业单位"
								/>
								<f:selectItem
									itemLabel="其他"
									itemValue="其他"
								/>
							</p:selectOneMenu>
	
							<p:outputLabel
								for="creditCode"
								value="统一社会信用代码"
							/>
							<p:inputText
								id="creditCode"
								value="#{serviceSupplierHome.instance.creditCode}"
								required="true"
								styleClass="input-large"
							>
								<f:validator binding="#{supplierCreditcodeValidator}"></f:validator>
								<f:ajax render="@this"/>
							</p:inputText>
							
							<p:outputLabel
								for="username"
								value="山东政务服务门户网站登录名"
								rendered="#{not serviceSupplierHome.managed}"
							/>
							<p:inputText
								id="username"
								value="#{serviceSupplierHome.instance.username}"
								required="true"
								rendered="#{not serviceSupplierHome.managed}"
							>
								<f:validator binding="#{usernameValidator}"></f:validator>
								<f:ajax render="@this" />
							</p:inputText>

	
							<p:outputLabel
								for="email"
								value="电子邮箱"
								rendered="#{not serviceSupplierHome.managed}"
							/>
							<p:inputText
								id="email"
								value="#{serviceSupplierHome.instance.email}"
								required="true"
								rendered="#{not serviceSupplierHome.managed}"
							>
								<f:validator binding="#{emailValidator}"></f:validator>
								<f:ajax render="@this"/>
							</p:inputText>
	
							<p:outputLabel
								for="registeredFund"
								value="注册资金(万元)"
							/>
							<p:inputNumber id="registeredFund" value="#{serviceSupplierHome.instance.registeredFund}" required="true"></p:inputNumber>	
						
							
							<p:outputLabel
								for="registrationAuthority"
								value="注册登记机关"
							/>
							<p:inputText
								id="registrationAuthority"
								value="#{serviceSupplierHome.instance.registrationAuthority}"
								required="true"
								styleClass="input-large"
							/>
	
							<p:outputLabel
								for="registrationNo"
								value="注册登记号"
							/>
							<p:inputText
								id="registrationNo"
								value="#{serviceSupplierHome.instance.registrationNo}"
							/>
	
							<p:outputLabel
								for="regtime"
								value="成立时间"
							/>
							<p:calendar
								id="regtime"
								value="#{serviceSupplierHome.instance.regtime}"
								required="true"
								pattern="yyyy-MM-dd"
								navigator="true"
								locale="zh_CN"
								inputStyleClass="input-small"
								showOn="button"
							/>
	
						<p:outputPanel>
								<p:outputLabel
									for="businessLicenseImageUpload"
									value="营业执照"
								/>
								<br />
								（扫描图片上传）
							</p:outputPanel>
							<p:outputPanel>
								<p:fileUpload
									id="businessLicenseImageUpload"
									widgetVar="businessLicenseImageUpload"
									mode="advanced"
									skinSimple="true"
									required="true"
									fileLimit="1"
									invalidSizeMessage="必须上传一张图片，大小不能超过3M!"
									allowTypes="/(\.|\/)(jpe?g|png)$/"
									fileLimitMessage="只能上传一个附件"
									sizeLimit="#{1024 * 1024 * 3}"
									uploadLabel="上传"
									cancelLabel="取消"
									update="editForm:businessLicenseImage"
									fileUploadListener="#{serviceSupplierHome.uploadBusinessLicenseImage}"
								></p:fileUpload>
								<p:panel
									id="businessLicenseImage" styleClass="certs" >
									<p:outputLabel rendered="#{serviceSupplierHome.instance.businessLicenseImages.size() > 0}">
										<img  data-original="#{attachmentUtils.getFullPath(serviceSupplierHome.instance.businessLicenseImages[0])}" src="#{attachmentUtils.getFullPath(serviceSupplierHome.instance.businessLicenseImages[0])}"  id="img" width="240"/>
										<p:commandLink styleClass="closeBtn" action="#{serviceSupplierHome.removeBussinessImage()}"  update="editForm:businessLicenseImageUpload,editForm:businessLicenseImage" immediate="true" ></p:commandLink>
									</p:outputLabel>
									
								</p:panel>
							</p:outputPanel>
							
							<ui:remove>
								<p:outputPanel>
									<p:outputLabel
										for="taxProveImagesUpload"
										value="纳税证明"
									/>
									<br />
									（扫描图片上传）
								</p:outputPanel>
								<p:outputPanel>												
									<p:fileUpload
										id="taxProveImagesUpload"
										label="选择"
										mode="advanced"
										multiple="true"
										skinSimple="true"
										sizeLimit="#{1024 * 1024 * 3}"
										uploadLabel="上传"
										cancelLabel="取消"
										update="editForm:taxProveImageList"
										fileUploadListener="#{serviceSupplierHome.uploadTaxProveImages}"
										allowTypes="/(\.|\/)(jpe?g|png)$/"
									/>
									<p:panel
										id="taxProveImageList"
										widgetVar="taxProveImageList">
										<p:dataList
											value="#{serviceSupplierHome.instance.taxProveImages}"
											var="_taxImage"
											rendered="#{serviceSupplierHome.instance.taxProveImages.size() > 0}"
											itemStyleClass="photoItem"
											varStatus="_certPhotoStatus"
										>
											<img  data-original="#{attachmentUtils.getFullPath(_taxImage)}" src="#{attachmentUtils.getFullPath(_taxImage)}"  id="img" width="240"/>
											<p:commandLink styleClass="closeBtn" action="#{serviceSupplierHome.removeTaxImage(_taxImage)}" update="editForm:taxProveImageList" immediate="true" ></p:commandLink>
										</p:dataList>
										<div style="clear: both" />
									</p:panel>
								</p:outputPanel>
							</ui:remove>
							
							<p:outputLabel
								for="address"
								value="办公地址"
							/>
							<p:inputText
								id="address"
								value="#{serviceSupplierHome.instance.address}"
								required="true"
								styleClass="input-xlarge"
							/>
	
							<p:outputLabel
								for="legalPerson"
								value="法定代表人"
							/>
							<p:inputText
								id="legalPerson"
								value="#{serviceSupplierHome.instance.legalPerson}"
								required="true"
								styleClass="input-mini"
							/>
	
							<p:outputLabel
								for="legalPersonPhoneNumber"
								value="法定代表人联系电话"
							/>
							<p:inputText
								id="legalPersonPhoneNumber"
								value="#{serviceSupplierHome.instance.legalPersonPhoneNumber}"
								required="true"
								styleClass="input-small"
							/>
	
							<p:outputLabel
								for="firstContactor"
								value="第一联系人"
							/>
							<p:inputText
								id="firstContactor"
								value="#{serviceSupplierHome.instance.firstContactor}"
								required="true"
								styleClass="input-mini"
							/>
	
							<p:outputLabel
								for="firstContactorPhoneNumber"
								value="第一联系人电话"
							/>
							<p:inputText
								id="firstContactorPhoneNumber"
								value="#{serviceSupplierHome.instance.firstContactorPhoneNumber}"
								required="true"
								styleClass="input-small"
							/>
	
							<p:outputLabel
								for="secondContactor"
								value="第二联系人"
							/>
							<p:inputText
								id="secondContactor"
								value="#{serviceSupplierHome.instance.secondContactor}"
								required="true"
								styleClass="input-mini"
							/>
	
							<p:outputLabel
								for="secondContactorPhoneNumber"
								value="第二联系人电话"
							/>
							<p:inputText
								id="secondContactorPhoneNumber"
								value="#{serviceSupplierHome.instance.secondContactorPhoneNumber}"
								required="true"
								styleClass="input-small"
							/>
	
							<p:outputLabel
								for="employeeCount"
								value="员工数"
							/>
							<p:inputText
								id="employeeCount"
								value="#{serviceSupplierHome.instance.employeeCount}"
								required="true"
								styleClass="input-mini"
							/>
	
							<p:outputLabel
								for="highTitleEmployeeCount"
								value="高级职称人数"
							/>
							<p:inputText
								id="highTitleEmployeeCount"
								value="#{serviceSupplierHome.instance.highTitleEmployeeCount}"
								required="true"
								styleClass="input-mini"
							/>
	
							<p:outputLabel
								for="mediumTitleEmployeeCount"
								required="true"
								value="中级职称人数"
							/>
							<p:inputText
								id="mediumTitleEmployeeCount"
								value="#{serviceSupplierHome.instance.mediumTitleEmployeeCount}"
								required="true"
								styleClass="input-mini"
							/>
	
							<p:outputLabel
								for="beginnerTitleEmployeeCount"
								value="初级职称人数"
							/>
							<p:inputText
								id="beginnerTitleEmployeeCount"
								value="#{serviceSupplierHome.instance.beginnerTitleEmployeeCount}"
								styleClass="input-mini"
							/>
	
							<p:outputLabel
								for="govServiceSupplier"
								value="是否政府服务供应商"
							/>
							<p:selectBooleanCheckbox
								id="govServiceSupplier"
								value="#{serviceSupplierHome.instance.govServiceSupplier}"
							/>
	
							<p:outputLabel
								for="region"
								value="中介机构所在地区"
							/>
							<p:selectOneMenu id="region"
											 value="#{serviceSupplierHome.instance.region}"
											 required="true">
								<f:selectItem itemLabel="请选择" itemValue="#{null}"  />
								<f:selectItems value="#{codeDicUtils.getCodeDicList('所在地区')}" var="_codeDic" itemValue="#{_codeDic.codeValue}"
											   itemLabel="#{_codeDic.codeName}" />
							</p:selectOneMenu>

	
							<p:outputLabel
								for="alwaysValid"
								value="营业期限"
							/>
							<p:selectOneRadio
								id="alwaysValid"
								value="#{serviceSupplierHome.instance.alwaysValid}"
								required="true"
							>
								<f:selectItem
									itemLabel="填写营业期限"
									itemValue="false"
									
								/>
								<f:selectItem
									itemLabel="长期有效"
									itemValue="true"
								/>
							</p:selectOneRadio>
							
							
	
							<p:outputLabel
								for="busnissAllotedTime"
								value="输入期限"
							/>
							<p:calendar
								id="busnissAllotedTime"
								value="#{serviceSupplierHome.instance.busnissAllotedTime}"
								pattern="yyyy-MM-dd"
								navigator="true"
								inputStyleClass="input-small"
								showOn="button"
							/>
							<p:outputLabel
								for="intro"
								value="机构简介"
							/>
							<p:inputTextarea
								id="intro"
								value="#{serviceSupplierHome.instance.intro}"
								required="true"
								rows="5"
								maxlength="1000"
								counter="display"
								autoResize="false"
								cols="40"
								counterTemplate="还能输入{0}个字 。"
								styleClass="input-xlarge"
							/>
							<h:outputText id="display" class="p-d-block template"/>
						</h:panelGrid>
					</p:panel>
					<p:tooltip for="username" position="right" value="此登录名为山东政务服务网登录名（请到个人中心查看，不一定为手机号），无用户的需要先去山东政务服务网注册，请填写真实信息，否则无法登陆本系统！" />
					<p:remoteCommand name="updateBussinessPanel" immediate="true" update="businesses"></p:remoteCommand>
					<p:panel
						id="businesses"
						header="主营业务"
						widgetVar="businesses"
						style="margin-bottom:10px;"
						styleClass="nureg-cont nuregcbox nuregcboxsty"
					>
						<c:forEach
							items="#{serviceSupplierHome.instance.mainBusinesses}"
							var="_business"
							varStatus="_status"
						>
							<div class="certs">
								
								<p:commandLink
									styleClass="removeButton"
									rendered="#{_status.index > 0}"
									immediate="true"
									action="#{serviceSupplierHome.removeBusiness()}"
									ajax="true"
									oncomplete="updateBussinessPanel()">
									<f:setPropertyActionListener
										value="#{_business}"
										target="#{serviceSupplierHome.currentBusiness}"
									></f:setPropertyActionListener>
									<f:setPropertyActionListener
										value="#{_business.bussinessIndex}"
										target="#{serviceSupplierHome.currentBusinessIndex}"
									></f:setPropertyActionListener>
								</p:commandLink>
								<h2>主营业务#{_status.index + 1}</h2>
		
								<h:panelGrid
									columns="2"
									cellpadding="5"
								>
									<p:outputLabel
										for="agentServiceDetail#{_business.bussinessIndex}"
										value="服务事项"
									/>
									<p:outputPanel>
										<p:inputText
											id="agentServiceDetail#{_business.bussinessIndex}"
											widgetVar="agentServiceDetail#{_business.bussinessIndex}"
											value="#{_business.agentService.name}"
											required="true"
											readonly="true"
											styleClass="input-xlarge"
										/>
											<p:commandButton
												oncomplete="PF('chooseAgentServiceDialog').show();"
												value="选择"
												immediate="true"
												update="chooseAgentServiceDialog"
											>
												<f:setPropertyActionListener
													value="#{_business}"
													target="#{serviceSupplierHome.currentBusiness}"
												></f:setPropertyActionListener>
												<f:setPropertyActionListener
													value="#{_business.bussinessIndex}"
													target="#{serviceSupplierHome.currentBusinessIndex}"
												></f:setPropertyActionListener>
											</p:commandButton>
										
									</p:outputPanel>
		
									<p:outputLabel
										for="commitOfTime#{_business.bussinessIndex}"
										value="服务时限承诺"
									/>
									<p:inputText
										id="commitOfTime#{_business.bussinessIndex}"
										value="#{_business.commitOfTime}"
										required="true"
										styleClass="input-xlarge"
									/>
		
									<p:outputLabel
										for="commitOfPrice#{_business.bussinessIndex}"
										value="服务收费承诺"
									/>
									<p:inputText
										id="commitOfPrice#{_business.bussinessIndex}"
										value="#{_business.commitOfPrice}"
										required="true"
										styleClass="input-xlarge"
									/>
		
									<p:outputLabel
										for="commitOfQuality#{_business.bussinessIndex}"
										value="服务质量承诺"
									/>
									<p:inputText
										id="commitOfQuality#{_business.bussinessIndex}"
										value="#{_business.commitOfQuality}"
										required="true"
										styleClass="input-xlarge"
									/>
								</h:panelGrid>
								
								<p:panel>
									<p:outputLabel for="uploadImages#{_business.bussinessIndex}" value="请选择图片"></p:outputLabel>
									<p:fileUpload
										id="uploadImages#{_business.bussinessIndex}"
										mode="advanced"
										multiple="true"
										sequential="true"
										required="true"
										skinSimple="true"
										allowTypes="/(\.|\/)(jpe?g|png)$/"
										invalidFileMessage="文件类型错误，请上传png或jpg格式的图片"
										sizeLimit="#{1024 * 1024 * 3}"
										invalidSizeMessage="文件大小不能超过3M!"
										uploadLabel="上传"
										cancelLabel="取消"
										update="editForm:uploadedImages#{_business.bussinessIndex}"
										fileUploadListener="#{serviceSupplierHome.uploadAgentServicePhotos}"></p:fileUpload>					
									
									<p:dataTable id="uploadedImages#{_business.bussinessIndex}" value="#{_business.images}" var="_attr" rowIndexVar="_row" emptyMessage="无已上传图片">
									
										<p:column headerText="文件名">
											<h:outputText value="#{_attr.filename}" />
										</p:column>
															
										<p:column headerText="大小（MB）" style="text-align: right;">
											<h:outputText value="#{_attr.filesize / 1024 / 1024}">	
												<f:convertNumber minFractionDigits="2" groupingUsed="true" />
											</h:outputText>
										</p:column>
										
										<p:column headerText="预览">
											<img data-original="#{attachmentUtils.getFullPath( _attr )}" src="#{attachmentUtils.getFullPath( _attr )}" width="240"/>
										</p:column>
										
										<p:column headerText="操作">						
											<p:commandLink styleClass="closeBtn" action="#{serviceSupplierHome.removeAgentServicePhoto(_row, _attr)}"  update="editForm:uploadedImages#{_business.bussinessIndex}" immediate="true" ></p:commandLink>
										</p:column>
										
									</p:dataTable>
								</p:panel>
							</div>
						</c:forEach>
	
						<p:commandButton
							action="#{serviceSupplierHome.instance.addEmptyBusiness()}"
							update="businesses"
							value="添加业务"
							immediate="true"
						></p:commandButton>
					</p:panel>
					<p:remoteCommand name ="updateCerts" update="certs" immediate="true"></p:remoteCommand>
					<p:panel
						id="certs"
						header="资质证书"
						style="margin-bottom:10px;"
						styleClass="nureg-cont nuregcbox nuregcboxsty"
						widgetVar="certs"
					>
						<c:forEach
							items="#{serviceSupplierHome.instance.certs}"
							var="_cert"
							varStatus="_status"
						>
							<p:outputPanel id="cert_#{_cert.certIndex}" styleClass="certs" style="padding-top: 10px;">
								<p:commandLink
									styleClass="removeButton"
									rendered="#{_status.index >= 0}"
									action="#{serviceSupplierHome.removeCert()}"
									oncomplete="updateCerts()"
									immediate="true">
									<f:setPropertyActionListener
										value="#{_cert}"
										target="#{serviceSupplierHome.currentCert}"
									></f:setPropertyActionListener>
									<f:setPropertyActionListener
										value="#{_cert.certIndex}"
										target="#{serviceSupplierHome.currentCertIndex}"
									></f:setPropertyActionListener>
								</p:commandLink>
								<h2>资质证书#{_status.index + 1}</h2>
		
								<p:panelGrid>
									<p:row>
										<p:column>
											<p:outputLabel
												for="qualificationClass#{_cert.certIndex}"
												value="资质类别"
											/>
										</p:column>
										<p:column colspan="5">
											<p:selectOneMenu
												id="qualificationClass#{_cert.certIndex}"
												value="#{_cert.qualificationClass}"
												immediate="true"
												filter="true" 
												filterMatchMode="contains"
											>
												<f:selectItem
													itemLabel="请选择"
													itemValue="#{null}"
												/>
												<f:selectItems
													value="#{qualificationClassList.resultList}"
													var="_qc"
													itemLabel="#{_qc.name}"
													itemValue="#{_qc}"
												/>
												<f:converter converterId="entityConverter"></f:converter>
												
												<f:ajax  listener="#{serviceSupplierHome.changeQualificationClass()}" render="cert_#{_cert.certIndex}"></f:ajax>
												
											</p:selectOneMenu>
										</p:column>
									</p:row>			
									
									<c:forEach items="#{_cert.qualificationTemplates}" var="_qualificationTemplate" varStatus="_qtStatus">
										<p:row>
											<p:column>
												<p:outputLabel
													for="level#{_cert.certIndex}_#{_qualificationTemplate.templateIndex}"
													value="等级"
												/>
											</p:column>
											<p:column>
												<p:selectOneMenu
													id="level#{_cert.certIndex}_#{_qualificationTemplate.templateIndex}"
													value="#{_qualificationTemplate.qualificationLevel}"
													required="true"
													widgetVar="level#{_cert.certIndex}_#{_qualificationTemplate.templateIndex}"
												>
													<f:selectItem
														itemLabel="请选择"
														itemValue="#{null}"
													/>
													<f:selectItems
														value="#{_cert.qualificationClass.sortedLevelOptions}"
														var="_lo"
														itemLabel="#{_lo.name}"
														itemValue="#{_lo}"
													></f:selectItems>
													<f:converter converterId="entityConverter"></f:converter>	
													<f:ajax></f:ajax>
												</p:selectOneMenu>
											</p:column>
										
											<p:column>
												<p:outputLabel
													for="sector#{_cert.certIndex}_#{_qualificationTemplate.templateIndex}"
													value="行业范围"
												/>
											</p:column>
											<p:column colspan="2">
												<p:inputText
													id="sector#{_cert.certIndex}_#{_qualificationTemplate.templateIndex}"
													value="#{_qualificationTemplate.getSectorNames()}"
													required="true"
													readonly="true"
													widgetVar="sector#{_cert.certIndex}_#{_qualificationTemplate.templateIndex}"
												/>
												<p:commandButton
													oncomplete="PF('chooseSectorDialog').show();"
													value="选择"
													immediate="true"
													action="#{serviceSupplierHome.initRootNode()}"
													update="chooseSectorDialog"
												>
													<f:setPropertyActionListener
														value="#{_cert}"
														target="#{serviceSupplierHome.currentCert}"
													></f:setPropertyActionListener>
													<f:setPropertyActionListener
														value="#{_cert.certIndex}"
														target="#{serviceSupplierHome.currentCertIndex}"
													></f:setPropertyActionListener>
													<f:setPropertyActionListener
														value="#{_qualificationTemplate}"
														target="#{serviceSupplierHome.currentQualificationTemplate}"
													></f:setPropertyActionListener>
													<f:setPropertyActionListener
														value="#{_qualificationTemplate.templateIndex}"
														target="#{serviceSupplierHome.currentQualificationTemplateIndex}"
													></f:setPropertyActionListener>
												</p:commandButton>
											</p:column>
											
											<p:column>
												<p:commandButton value="加行" action="#{_cert.addEmptyQualificationTemplate()}" oncomplete="updateCerts()" immediate="true"></p:commandButton>
												<p:commandButton value="删除" action="#{serviceSupplierHome.removeQualificationTemplate(_cert.certIndex,_qualificationTemplate.templateIndex)}" oncomplete="updateCerts()" immediate="true" rendered="#{_qtStatus.index > 0}">
													<f:setPropertyActionListener
														value="#{_cert}"
														target="#{serviceSupplierHome.currentCert}"
													></f:setPropertyActionListener>
													<f:setPropertyActionListener
														value="#{_cert.certIndex}"
														target="#{serviceSupplierHome.currentCertIndex}"
													></f:setPropertyActionListener>
													<f:setPropertyActionListener
														value="#{_qualificationTemplate}"
														target="#{serviceSupplierHome.currentQualificationTemplate}"
													></f:setPropertyActionListener>
													<f:setPropertyActionListener
														value="#{_qualificationTemplate.templateIndex}"
														target="#{serviceSupplierHome.currentQualificationTemplateIndex}"
													></f:setPropertyActionListener>
												</p:commandButton>
											</p:column>
										</p:row>								
									</c:forEach>
									
									<p:row>
										<p:column>
											<p:outputLabel
												for="approveDate#{_cert.certIndex}"
												value="批准时间"
											/>
										</p:column>
										<p:column>
											<p:calendar
												id="approveDate#{_cert.certIndex}"
												value="#{_cert.approveDate}"
												required="true"
												pattern="yyyy-MM-dd"
												navigator="true"
												inputStyleClass="input-small"
												showOn="button"												
											>
											</p:calendar>
										</p:column>
										<p:column>
											<p:outputLabel
												for="approveLicenseNo#{_cert.certIndex}"
												value="批准文号/资质证书号"
											/>
										</p:column>
										<p:column>
											<p:inputText
												id="approveLicenseNo#{_cert.certIndex}"
												value="#{_cert.approveLicenseNo}"
												required="true"
											>
											</p:inputText>
										</p:column>
										<p:column>
											<p:outputLabel
												for="contactor#{_cert.certIndex}"
												value="联系人"
											/>
										</p:column>
										<p:column>
											<p:inputText
												id="contactor#{_cert.certIndex}"
												value="#{_cert.contactor}"
												required="true"
												styleClass="input-small"
											>
											</p:inputText>
										</p:column>
									</p:row>
																
									<p:row>
										<p:column>
											<p:outputLabel
												for="contactorPhoneNumber#{_cert.certIndex}"
												value="联系人电话"
											/>
										</p:column>
										<p:column>
											<p:inputText
												id="contactorPhoneNumber#{_cert.certIndex}"
												value="#{_cert.contactorPhoneNumber}"
												required="true"
												styleClass="input-small"
											>
											</p:inputText>
										</p:column>
										<p:column>
											<p:outputLabel
												for="allotedDate#{_cert.certIndex}"
												value="有效日期"
											/>
										</p:column>
										<p:column>
											<p:calendar
												id="allotedDate#{_cert.certIndex}"
												value="#{_cert.allotedDate}"
												required="true"
												pattern="yyyy-MM-dd"
												navigator="true"
												inputStyleClass="input-small"
												showOn="button"
											>
											</p:calendar>
										</p:column>
										<p:column>
											<p:outputLabel
												for="approveDepartmentName#{_cert.certIndex}"
												value="资质审核机关"
											/>
										</p:column>
										<p:column>
											<p:inputText
												id="approveDepartmentName#{_cert.certIndex}"
												value="#{_cert.approveDepartmentName}"
												required="true"
											>
											</p:inputText>
										</p:column>
									</p:row>
									
									<p:row>
										<p:column>
											<p:outputPanel>
												<p:outputLabel
													for="certPhotos#{_cert.certIndex}"
													value="单位资质证书"
												/>
												<br />
												（扫描图片上传）
											</p:outputPanel>
										</p:column>
										<p:column colspan="5">
											
											<p:outputPanel>												
												<p:fileUpload
													id="certPhotos#{_cert.certIndex}"
													label="选择"
													mode="advanced"
													required="true"
													multiple="true"
													skinSimple="true"
													sizeLimit="#{1024 * 1024 * 3}"
													uploadLabel="上传"
													cancelLabel="取消"
													update="editForm:certPhotosList#{_cert.certIndex}"
													fileUploadListener="#{serviceSupplierHome.uploadCertPhotos}"
													allowTypes="/(\.|\/)(jpe?g|png)$/"
												/>
												<p:panel
													id="certPhotosList#{_cert.certIndex}"
													widgetVar="certPhotosList#{_cert.certIndex}">
													<p:dataList
														value="#{_cert.certPhotos}"
														var="_photo"
														rendered="#{_cert.certPhotos.size() > 0}"
														itemStyleClass="photoItem"
														varStatus="_certPhotoStatus"
													>
														<img  data-original="#{attachmentUtils.getFullPath(_photo)}" src="#{attachmentUtils.getFullPath(_photo)}"  width="240"/>
														
														<p:commandLink styleClass="closeBtn" action="#{serviceSupplierHome.removeCertPhoto(_status.index, _photo)}" update="editForm:certPhotosList#{_cert.certIndex}" immediate="true" ></p:commandLink>
													</p:dataList>
													<div style="clear: both" />
												</p:panel>
											</p:outputPanel>
										</p:column>
									</p:row>		
									<p:row>
										<p:column>
											<h:outputLabel value="是否隐藏" />
										</p:column>
										<p:column colspan="5">
											<p:selectBooleanCheckbox id="hidden#{_cert.certIndex}" value="#{_cert.hidden}" styleClass="hiddenCheckbox"></p:selectBooleanCheckbox>
											<p:tooltip id="toolTipGrow#{_cert.certIndex}" for="hidden#{_cert.certIndex}" value="若选择隐藏信息，则可能无法被选取"
               									showEffect="clip" hideEffect="explode" position="right"/>
										</p:column>
									</p:row>
								</p:panelGrid>
							</p:outputPanel>
						</c:forEach>

						<p:commandButton
							value="添加证书"
							action="#{serviceSupplierHome.instance.addEmptyCert()}"
							update="@form:certs"
							immediate="true"
						></p:commandButton>
					</p:panel>
	
					<p:panel
						id="attachmentsPanel"
						header="相关附件"
						style="margin-bottom:10px;"
						styleClass="nureg-cont nuregcbox nuregcboxsty"
					>
						<p:fileUpload
							id="attachmentUploadFile"
							label="选择"
							mode="advanced"
							multiple="true"
							skinSimple="true"
							sizeLimit="#{1024 * 1024 * 3}"
							uploadLabel="上传"
							cancelLabel="取消"
							update="editForm:uploadedAttachments"
							fileUploadListener="#{serviceSupplierHome.uploadAttachment}"
						/>
						<p:panel id="uploadedAttachments">
							<ul>
								<p:repeat var="_attachment" value="#{serviceSupplierHome.instance.attachments}">
									<li>
										<h:outputText value="#{_attachment.filename}" />
										<span>
											<p:commandLink action="#{serviceSupplierHome.removeAttachment(_attachment)}" update="editForm:uploadedAttachments" immediate="true" >×</p:commandLink>
										</span>
									</li>
								</p:repeat>
							</ul>
						</p:panel>
					</p:panel>
					
					<p:outputLabel id="actionButtons" rendered="#{not serviceSupplierHome.managed || request.isUserInRole('admin')}">
						<p:commandButton
							id="saveBtn"
							action="#{serviceSupplierHome.saveAndFlush()}"
							value="保存"
							ajax="true"
						/>
						<p:commandButton
							action="#{serviceSupplierHome.cancel()}"
							value="取消"
							immediate="true"
						></p:commandButton>
					</p:outputLabel>
		
					<p:blockUI block="editForm" trigger="saveBtn" />
				</h:form>
			
			</div>
		</div>		

		<p:dialog
			id="chooseSectorDialog"
			widgetVar="chooseSectorDialog"
			width="666"
			height="520"
			modal="true"
		>
			<h:form>
				<p:panel>
					<f:facet name="header">选择行业</f:facet>
					
					<p:scrollPanel style="height: 400px; border: 0px;" mode="native" rendered="#{serviceSupplierHome.instance.certs.size() > 0}">
						<p:treeTable
							value="#{serviceSupplierHome.rootNodeMap[serviceSupplierHome.currentCertIndex][serviceSupplierHome.currentQualificationTemplateIndex]}"
							var="_sectorNode"
							
							selectionMode="checkbox"
							selection="#{serviceSupplierHome.selectedNodeMap[serviceSupplierHome.currentCertIndex][serviceSupplierHome.currentQualificationTemplateIndex]}"
						>
							<p:column>
								<f:facet name="header">行业类别</f:facet>
								#{_sectorNode.name}
							</p:column>
						</p:treeTable>
					</p:scrollPanel>

					<f:facet name="footer">
						<p:commandButton
							value="确定"
							action="#{serviceSupplierHome.chooseSectors()}"
							update=":editForm:sector#{serviceSupplierHome.currentCertIndex}_#{serviceSupplierHome.currentQualificationTemplateIndex}"
							oncomplete="PF('chooseSectorDialog').hide();"
							rendered="#{serviceSupplierHome.instance.certs.size() > 0}"
						/>
						<p:commandButton
							value="取消"
							onclick="PF('chooseSectorDialog').hide();"
						/>
					</f:facet>
				</p:panel>
			</h:form>
		</p:dialog>
		
		<p:dialog
			id="chooseAgentServiceDialog"
			widgetVar="chooseAgentServiceDialog"
			width="666"
			height="600"
			modal="true"
		>
			<h:form>
				<p:panel>
					<f:facet name="header">选择服务事项</f:facet>
					
					<p:scrollPanel style="height: 450px; border: 0px;" mode="native" >
						 <p:dataTable var="_service"  value="#{agentServiceList.resultList}" rows="10"
                         paginator="true"
                         paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                         rowsPerPageTemplate="5,10,15"
                          selection="#{serviceSupplierHome.selectedAgentServiceMap[serviceSupplierHome.currentBusinessIndex]}" rowKey="#{_service.name}">                   
                          <p:column selectionMode="single" style="width:16px;text-align:center"/>
					        <p:column headerText="服务事项名称">
					            <h:outputText value="#{_service.name}" />
					        </p:column>
				        	<p:column headerText="对应资质大类">
					            <h:outputText value="#{_service.qualificationClass.name}" />
					        </p:column>
				        </p:dataTable>
					</p:scrollPanel>
					<f:facet name="footer">
						<p:commandButton
							value="确定"
							action="#{serviceSupplierHome.updateAgentService()}"
							update="editForm:agentServiceDetail#{serviceSupplierHome.currentBusinessIndex}"
							oncomplete="PF('chooseAgentServiceDialog').hide();"
						/>
						<p:commandButton
							value="取消"
							onclick="PF('chooseAgentServiceDialog').hide();"
						/>
					</f:facet>
				</p:panel>
			</h:form>
		</p:dialog>
	</ui:define>
</ui:composition>
